package com.expdatacloud.controller.store;

import com.expdatacloud.dto.ApiResponse;
import com.expdatacloud.service.DifferenceMSAService;
import com.expdatacloud.vo.StoreDifferenceVo;
import com.github.pagehelper.PageInfo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import javax.servlet.http.HttpSession;

/**
 * 库存差异控制类
 *
 * @author jie
 * @date 2019/12/23 -21:08
 */
@RequestMapping("/diff")
@RestController
public class StoreDifferenceController {

    @Autowired
    private DifferenceMSAService differenceMSAService;

    @GetMapping("/getDiffStore")
    public ApiResponse getDiffStore(@RequestParam(defaultValue = "1") int page, @RequestParam(defaultValue = "20") int limit,
                                    HttpSession session,String storerkey,
                                    String sku,
                                    String lottable01,
                                    String lottable02,
                                    String differ) {

        PageInfo<StoreDifferenceVo> pageInfo = differenceMSAService.getDiffStore(storerkey, sku, lottable01, lottable02,differ, page, limit);
        return ApiResponse.ok(pageInfo.getTotal(), pageInfo.getList());

    }

}
